import request from '@/config/axios'

// 试卷资源 VO
export interface ExamVO {
  id: string // 唯一标识
  examName: string // 试卷名称
  chapter: string // 章节
  grade: number // 年级
  bookId: number // 书籍id
  bookName: string // 书籍名称
  examUrl: string // 资源地址
  sort: number // 排序
}

// 试卷资源 API
export const ExamApi = {
  // 查询试卷资源分页
  getExamPage: async (params: any) => {
    return await request.get({ url: `/xhyy/exam/page`, params })
  },

  // 查询试卷资源详情
  getExam: async (id: number) => {
    return await request.get({ url: `/xhyy/exam/get?id=` + id })
  },

  // 新增试卷资源
  createExam: async (data: ExamVO) => {
    return await request.post({ url: `/xhyy/exam/create`, data })
  },

  // 修改试卷资源
  updateExam: async (data: ExamVO) => {
    return await request.put({ url: `/xhyy/exam/update`, data })
  },

  // 删除试卷资源
  deleteExam: async (id: number) => {
    return await request.delete({ url: `/xhyy/exam/delete?id=` + id })
  },

  // 导出试卷资源 Excel
  exportExam: async (params) => {
    return await request.download({ url: `/xhyy/exam/export-excel`, params })
  },
}
